home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / xcontact / lib / VkPrintDialog.h < prev   
Encoding:
C/C++ Source or Header  |  1994-08-02  |  5.5 KB  |  176 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #ifndef VKPRINTDIALOG_H
  18. #define VKPRINTDIALOG_H
  19. /////////////////////////////////////////////////////////////////////////
  20. // VkPrintDialog.h --
  21. //    A ViewKit dialog class for print spooler interface widget.
  22. //
  23. //    This class requires impressario development option.
  24. //    Linkage: -lprintui -lspool 
  25. //
  26. //   ivan hajadi@csd.sgi.com
  27. /////////////////////////////////////////////////////////////////////////
  28.  
  29. #include <Vk/VkGenericDialog.h>
  30. #include <X11/Xirisw/PrintBox.h>
  31.  
  32.  
  33. class VkPrintDialog : public VkGenericDialog {
  34.  
  35.  private:
  36.  
  37.   static String _defaultResources[];
  38.  
  39.   static void cancelCB( Widget, XtPointer, XtPointer );
  40.   static void errorCB( Widget, XtPointer, XtPointer );
  41.   static void jobInfoCB( Widget, XtPointer, XtPointer );
  42.   static void printCB( Widget, XtPointer, XtPointer );
  43.   static void printerActionCB( Widget, XtPointer, XtPointer );
  44.   static void printerSelectCB( Widget, XtPointer, XtPointer );
  45.   static void user1CB( Widget, XtPointer, XtPointer );
  46.   static void user2CB( Widget, XtPointer, XtPointer );
  47.   static void helpCB( Widget, XtPointer, XtPointer );
  48.  
  49.   Widget    _printDialog;
  50.  
  51.   ArgList    _args;
  52.   Cardinal    _count;
  53.   char*        _helpString;
  54.  
  55.   Widget createDialog( Widget );
  56.  
  57.   // Dynamically settable values during the life of the object.
  58.   Boolean     _fileNameEditable;
  59.   char*     _fileName;
  60.   int        _fileDescriptor;
  61.  
  62.   // Do the common initialization for VkPrintDialog.
  63.   void init();
  64.  
  65.  protected:
  66.  
  67.   // Subclass can set these options in constructor. 
  68.   Boolean     _showOptions;
  69.   Boolean     _showFileName;
  70.   Boolean     _showHelp;
  71.   Boolean     _showUser1;
  72.   Boolean     _showUser2;
  73.  
  74.   enum JobType { FILENAMES, FILEDESCRIPTOR, BUFFER };
  75.   JobType       _jobType;
  76.   XtPointer    _buffer;
  77.   int        _bufSize;
  78.  
  79.   // Subclass can customize this dialog.
  80.   Widget    _workArea;
  81.   virtual Widget createWorkArea( Widget /* parent */ ) { return NULL; }
  82.  
  83.  public:
  84.   
  85.   // Pass <resource,value> list which ends with NULL - like XtVaCreate..
  86.   VkPrintDialog( const char* name, String argName, XtArgVal argValue ... );
  87.   VkPrintDialog( const char* name );  
  88.   virtual ~VkPrintDialog();
  89.  
  90.   const char* fileName() const { return _fileName; }
  91.   Boolean fileNameEditable() const { return _fileNameEditable; }
  92.   int fileDescriptor() const { return _fileDescriptor; }
  93.  
  94.   void setFileName( const char* fileName );
  95.   void setFileNameEditable( Boolean );
  96.   void setBuffer( XtPointer buf, int bufSize );
  97.   void setFileDescriptor( int fd );
  98.  
  99.  
  100.   Widget getChild( int );
  101.   void setButtonLabels( const char *print=NULL, 
  102.             const char *cancel=NULL,
  103.             const char *help=NULL,
  104.             const char *user1=NULL,
  105.             const char *user2=NULL );
  106.  
  107.   void showHelp( Boolean );
  108.   void showUser1( Boolean );
  109.   void showUser2( Boolean );
  110.  
  111.   
  112.   // Not recommended to use these directly.  Use the conviniences.
  113.   virtual Widget post (const char      *message    = NULL,
  114.                XtCallbackProc   okCB       = NULL,
  115.                XtCallbackProc   cancelCB   = NULL,
  116.                XtCallbackProc   applyCB    = NULL,
  117.                XtPointer        clientData = NULL,
  118.                const char      *helpString = NULL,
  119.                VkSimpleWindow  *parent     = NULL,
  120.                Widget         parentWidget = NULL);
  121.  
  122.  
  123.   virtual Widget postModal (const char      *message    = NULL,
  124.                 XtCallbackProc   okCB       = NULL,
  125.                 XtCallbackProc   cancelCB   = NULL,
  126.                 XtCallbackProc   applyCB    = NULL,
  127.                 XtPointer        clientData = NULL,
  128.                 const char      *helpString = NULL,
  129.                 VkSimpleWindow  *parent     = NULL,
  130.                 Widget         parentWidget = NULL);
  131.  
  132.   virtual Widget postBlocked (const char      *message    = NULL,
  133.                   XtCallbackProc   okCB       = NULL,
  134.                   XtCallbackProc   cancelCB   = NULL,
  135.                   XtCallbackProc   applyCB    = NULL,
  136.                   XtPointer        clientData = NULL,
  137.                   const char      *helpString = NULL,
  138.                   VkSimpleWindow  *parent     = NULL,
  139.                   Widget         parentWidget = NULL);
  140.  
  141.  
  142.   virtual VkDialogReason postAndWait (const char      *message    = NULL,
  143.                       int          ok         = -1,
  144.                       int          cancel     = -1,
  145.                       int          apply      = -1,
  146.                       const char      *helpString = NULL,
  147.                       VkSimpleWindow  *parent     = NULL,
  148.                       Widget         parentWidget = NULL);
  149.  
  150.  
  151.  
  152.   // Sub class can override these to do something.
  153.   virtual void cancel(Widget, XtPointer) {}
  154.   virtual void error(Widget, XtPointer) {}
  155.   virtual void jobInfo(Widget, XtPointer) {}
  156.   virtual void print(Widget, XtPointer) {}
  157.   virtual void printerAction(Widget, XtPointer) {}
  158.   virtual void printerSelect(Widget, XtPointer) {}
  159.   virtual void user1(Widget, XtPointer) {}
  160.   virtual void user2(Widget, XtPointer) {}
  161.  
  162.   // By default help will launch SGI Help Server.
  163.   virtual void help(Widget, XtPointer);
  164.   
  165.  
  166.   operator Widget() const { return _printDialog; }
  167.  
  168.  
  169. };
  170.  
  171.  
  172. extern VkPrintDialog* thePrintDialog;
  173.  
  174.  
  175. #endif
  176.